package com.common.platform.sys.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 业务线程池统一配置
 * 业务service不单独新建线程池
 *
 * @author xiezhixiang
 */
@Data
@ConfigurationProperties(prefix = "thread-pool")
public class ThreadPoolProperties {

    /**
     * 线程池维护线程的最少数量,核心线程数量
     */
    private Integer corePoolSize;
    /**
     * 允许的空闲时间
     */
    private Integer  keepAliveSeconds;
    /**
     * 线程池维护线程的最大数量
     */
    private Integer  maxPoolSize;
    /**
     * 缓存队列
     */
    private Integer queueCapacity;
    /**
     * 线程命名
     */
    private String threadNamePrefix;

}
